package net.softwarefabrik.bde.core.model.platform;

import java.io.File;

import net.softwarefabrik.bde.core.model.BDEException;

/**
 * The interface for <code>PlatformProvider</code> services which are managed
 * by the <code>PlatformService</code>.
 * 
 * @author Matthias Kuespert
 */
public interface PlatformProvider {

    /**
     * Retrieves the platform name.
     * 
     * @return The name of the platform for display purposes.
     */
    public String getPlatformName();

    /**
     * Retrieves the platform ID.
     * 
     * @return The ID of the platform for building filenames, directories, etc.
     */
    public String getPlatformId();

    /**
     * @return The Maven group-id of the platform jar
     */
    public String getGroupId();
    
    /**
     * @return The Maven artifact-id of the platform jar
     */
    public String getArtifactId();
    
    /**
     * Retrieves the fully qualified name of the main class used to run this
     * platform.
     * 
     * @param config The <code>PlatformConfiguration</code> to use.
     * @return The main class of the platform to use.
     */
    public String getMainClass();

    /**
     * Prepares the platform for launching.
     * 
     * @param config The <code>PlatformConfiguration</code> to use.
     * @throws BDEException if something goes wrong
     */
    public void preparePlatform(PlatformConfiguration config) throws BDEException;

    /**
     * Retrieves the platform .jar.
     * 
     * @param config The <code>PlatformConfiguration</code> to use.
     * @return The platform jar file.
     * @throws BDEException if something goes wrong
     */
    public File getPlatformJar(PlatformConfiguration config) throws BDEException;

    /**
     * Retrieves the startup arguments.
     * 
     * @param config The <code>PlatformConfiguration</code> to use.
     * @return The runtime arguments to use.
     * @throws BDEException if something goes wrong
     */
    public String[] getRuntimeArguments(PlatformConfiguration config) throws BDEException;

    /**
     * Retrieves the startup VM options.
     * 
     * @param config The <code>PlatformConfiguration</code> to use.
     * @return The runtime VM options to use.
     * @throws BDEException if something goes wrong
     */
    public String[] getRuntimeVMOptions(PlatformConfiguration config) throws BDEException;
}
